package stackdemo;

import stackdemo.MyStack;
import stackdemo.Node;

import java.util.Stack;

public class Test {

    public static void main4(String[] args) {
        Node head = new Node(11);
        Node node2 = new Node(22);
        Node node3 = new Node(33);
        Node node4 = new Node(44);
        Node node5 = new Node(55);
        head.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
       Node node=new Node(0);
        node.stackPrintList(head);
    }
    public static void main3(String[] args) {
        Node head = new Node(1);
        Node node2 = new Node(2);
        Node node3 = new Node(3);
        Node node4 = new Node(4);
        Node node5 = new Node(5);
        head.next = node2;
        node2.next = node3;
        node3.next = node4;
        node4.next = node5;
        Node printer = new Node(0);
        System.out.print("链表逆序打印结果：");
        printer.printlist(head);
//        stackdemo.Node head = new stackdemo.Node(1);
//        head.next = new stackdemo.Node(2);
//        head.next.next = new stackdemo.Node(3);
//        head.next.next.next = new stackdemo.Node(4);
//        head.next.next.next.next = new stackdemo.Node(5);
//        stackdemo.Node node = new stackdemo.Node(0);
//        System.out.print("链表逆序打印结果：");
//        node.printlist(head);
    }

    public static void main2(String[] args) {
        MyStack myStack=new MyStack();
        myStack.push(11);
        myStack.push(22);
        myStack.push(33);
        System.out.println(myStack.pop());
        System.out.println(myStack.peek());
        System.out.println(myStack.size());
    }
    public static void main1(String[] args) {
        Stack<Integer> stack=new Stack<>();
        stack.push(11);
        stack.push(22);
        stack.push(33);
        stack.push(44);
        stack.push(55);
        System.out.println(stack);
        stack.pop();
        System.out.println("第一次出栈后的栈："+stack);
        stack.peek();
        System.out.println("获取栈顶的元素后的栈:"+stack);
        int size= stack.size();
        System.out.println("栈的元素个数："+size);
        System.out.println("栈是否为空："+stack.empty());
    }
}
